<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:web="http://www.web.com.br/jsf/webutils">

	<fieldset id="#{id}"
		style="display: #{not empty backingBean.rows ? 'block' : 'none'}">

		<legend style="font-weight: bold; font-size: 16px; width: auto;">#{messages['global.resultados.fieldset']}</legend>

		<web:dataTable id="#{id}" rendered="#{not empty backingBean.rows}"
			value="#{backingBean.rows}" style="#{style}"
			styleClass="dataTable-#{web:nvl(mode, 1)}"
			rowStyleClass="#{rowStyleClass}" mode="#{mode}"
			scrollable="#{scrollable}" scrollWidth="#{scrollWidth}">

			<ui:define name="columns">

				<web:column id="#{id}OptionsCol" align="center" width="90px"
					title="#{messages['global.options.title']}"
					rendered="#{backingBean.editable or backingBean.viewable or backingBean.deletable}">

					<h:panelGroup style="white-space: nowrap">

						 <web:commandButton id="#{id}cbtnEditC" value="#{null}"
							icon="#{messages['global.operations.edit.icon']}"
							title="#{messages['global.operations.edit']}"
							rendered="#{backingBean.editable}" action="prepareEdit"
							immediate="true" ajax="false" backingBean="#{backingBean}"
							style="margin-right: 5px;">

							<f:setPropertyActionListener value="#{dataTableItem}"
								target="#{backingBean.bean}" />

						</web:commandButton>

						<web:commandButton id="#{id}cbtnViewC" value="#{null}"
							icon="#{messages['global.operations.view.icon']}"
							title="#{messages['global.operations.view']}"
							rendered="#{backingBean.viewable}" action="prepareDetail"
							immediate="true" ajax="false" backingBean="#{backingBean}"
							style="margin-right: 5px;">

							<f:setPropertyActionListener value="#{dataTableItem}"
								target="#{backingBean.bean}" />

						</web:commandButton>

						 <web:commandButton id="#{id}cbtnDelC" value="#{null}"
							icon="#{messages['global.operations.delete.icon']}"
							title="#{messages['global.operations.delete']}" immediate="true"
							oncomplete="deleteDialog.show()"
							rendered="#{backingBean.deletable}" process="@this"
							backingBean="#{backingBean}" action="prepareDelete"
							style="margin-right: 5px;" update="@form">

							<f:setPropertyActionListener value="#{dataTableItem}"
								target="#{backingBean.bean}" />

						</web:commandButton> 

					</h:panelGroup>

				</web:column>

				<ui:insert />

			</ui:define>

		</web:dataTable>

	</fieldset>

	<p:dialog id="#{id}DeleteDialog"
		header="#{web:nvl(deleteMessage,messages['global.msg.confirmar_exclusao'])}"
		widgetVar="deleteDialog" resizable="false" modal="true">

		<h:outputText
			value="#{messages['global.msg.confirmar_exclusao']}: #{backingBean.msgDelete}?" />

		<web:clear />

		<p:commandButton value="#{messages['global.yes']}"
			action="#{backingBean.delete}" 
			update="@form" oncomplete="#deleteDialog.hide()"
			id="deleteDialog_btnYes" />

		<p:commandButton value="#{messages['global.no']}" immediate="true"
			onclick="deleteDialog.hide()" id="deleteDialog_btnNo" process="@this"
			update="@form" />
	</p:dialog>

</ui:composition>